# ===============================================================
# Filename: Makefile
# -------------------------------
# Copyright(C),
# Author: zhenquan.qiu
# Version: V1.0.0
# Last modified: 21/12 2016 11:49
# Description:
# 
# Change Log:
# NO.	Author		    Date		Modified
# 00	zhenquan.qiu	21/12 2016
# ===============================================================

ifneq ($(KERNELRELEASE),)
	obj-m := led_drv.o
else
	PROJECT_PATH 	:= /opt/qz/r16/parrot_android4.4/parrot-v1.1
	COMPILER_PATH 	:= $(PROJECT_PATH)/lichee/out/sun8iw5p1/android/common/buildroot/external-toolchain

	PATH := $(COMPILER_PATH)/bin:$(PATH)

	export CROSS_COMPILE := arm-linux-gnueabi-

	export ARCH 	:= arm
	export AS		:= ${CROSS_COMPILE}as
	export LD		:= ${CROSS_COMPILE}ld
	export CC		:= ${CROSS_COMPILE}gcc
	export AR		:= ${CROSS_COMPILE}ar
	export NM		:= ${CROSS_COMPILE}nm
	export STRIP	:= ${CROSS_COMPILE}strip
	export OBJCOPY	:= ${CROSS_COMPILE}objcopy
	export OBJDUMP	:= ${CROSS_COMPILE}objdump

#	KDIR := /lib/modules/`uname -r`/build
	KDIR := $(PROJECT_PATH)/lichee/linux-3.4
	PWD := $(shell pwd)

PROGRAM := led_tst

all:
	make -C $(KDIR) M=$(PWD) modules
#$(CC) $(PROGRAM).c -o $(PROGRAM)

clean:
	rm -rf *.o *.ko *.mod.c *.order *.symvers .*.cmd .tmp_versions $(PROGRAM)
endif


